package cn.st4rlight.util.response;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author st4rlight <st4rlight@163.com>
 * Created on 2024-04-14
 */
@Getter
@AllArgsConstructor
public enum ResultCode {

    // HTTP保留码
    SUCCESS(200, "OK"),

    /* 300-300是客户端需要做些事 */
    LOGIN_REQUIRED(302, "需要重新登录"),

    /* 400-400是客户端错误 */
    BAD_REQUEST(400, "非法请求"),
    UNAUTHORIZED(401, "未授权，请联系管理员"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "页面未找到"),
    LOGIN_FAIL(410, "登录失败"),
    PARAM_REQUIRED(411, "缺少必要参数"),
    PARAM_VALIDATION_FAILURE(412, "参数校验失败"),
    OPERATION_EXPIRED(413, "超时提交"),
    OPERATION_DUPLICATED(414, "重复提交"),
    OPERATION_UNSUPPORTED(415, "不支持的操作"),

    /* 500-599是服务端错误 */
    SERVICE_BUSY(500, "内部系统繁忙"),
    SERVICE_RATE_EXCEEDED(520, "请求超限"),
    RELY_SERVICE_BUSY(600, "外部系统繁忙"),

    /* 超过1000是自定义错误 */
    PARAM_INVALID(2001, "请求参数不正确，请确认后重新提交"),
    DATA_NOT_EXIST(2002, "所查询的数据不存在"),

    BIZ_CHECK_INVALID(3001, "业务校验错误，当前用户请求不具备所需条件"),

    NO_PERMISSION(4001, "当前用户无所请求资源的权限"),
    ;

    private final int code;
    private final String msg;
}
